using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace Domain
{
    public class Address : IValidatableObject
    {
        public string StreetName { get; set; }
        public string Number { get; set; }
        public string BusNumber { get; set; }
        public string PostcalCode { get; set; }
        public string PlaceName { get; set; }

        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (string.IsNullOrEmpty(PostcalCode) & string.IsNullOrEmpty(PlaceName))
            {
                yield return new ValidationResult("You must enter at least the Postal code or the place Name", new[] { "PostcalCode", "PlaceName" });
            }
        }
    }
}
